package own.stu.jobgib.playown.tools.poi;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Scanner;

// 注意类名必须为 Main, 不要有任何 package xxx 信息
public class Main {
    private static int power = 16;
    private static int aVal = 'a';
    private static int AVal = 'A';
    private static int zeroVal = '0';

    public static void main(String[] args) throws IOException{
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        // Scanner in = new Scanner(System.in);
        // 注意 hasNext 和 hasNextLine 的区别

        String str = null;
        while ((str = in.readLine()) != null) { // 注意 while 处理多个 case
            int num = Integer.parseInt(in.readLine());
            boolean[] map = new boolean[501];
            StringBuilder sb = new StringBuilder();
            for(int i = 0; i < num; i ++) {
                map[Integer.parseInt(in.readLine())] = true;
            }
            for(int i = 0; i < num; i ++){
                if(map[i]){
                    sb.append(i).append("\n");
                    //System.out.println(i);
                }
            }
            sb.deleteCharAt(sb.length() - 1);
            System.out.println(sb.toString());
        }

        in.close();
    }

    public static void main_1(String[] args) throws IOException {
        Scanner in = new Scanner(System.in);
        // 注意 hasNext 和 hasNextLine 的区别
        String str = null;
        while ((str = in.nextLine()) != null) { // 注意 while 处理多个 case
            //String str = in.nextLine();
            char[] cs = str.toCharArray();
            int ans = 0;
            for(int i = 2; i < cs.length; i ++){
                int cVal = (int)cs[i];
                int v = 0;
                if(cVal >= AVal){
                    v = cVal - AVal + 10;
                }else{
                    v = cVal - zeroVal;
                }
                // if('0' <= c && '9' >= c){
                //     v = c - '0';
                // }else if('a' <= c && 'f' >= c){
                //     v = c - 'a' + 10;
                // }else if('A' <= c && 'F' >= c){
                //     v = c - 'A' + 10;
                // }else {
                //     break;
                // }
                ans = ans * power + v;
            }
            System.out.println(ans);
        }
    }
}
